package 设计模式.工厂模式;

public class ShapeFactory {

    public Shape getShape(String type){
        if(type==null) return null;
        if(type.equalsIgnoreCase("circle")){
            return new Circle();
        }
        if(type.equalsIgnoreCase("rectangle")){
            return new Rectangle();
        }
        if(type.equalsIgnoreCase("square")){
            return new Square();
        }
        return null;
    }
}
